﻿using Open_Task_Request_System.Models;
using PerpetuumSoft.Knockout;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Open_Task_Request_System.Controllers
{
    public class TaskController : KnockoutController
    {
        //
        // GET: /Task/

        public ActionResult TaskList()
        {
            var model = new TaskListViewModel();
            model.Categories = new List<CategoriesModel>();
            using (var db = new Open_Task_Request_System.TasksEntities())
            {
                foreach (var category in db.Categories)
                {
                    model.Categories.Add(new CategoriesModel() { Id = category.c_Id, Name = category.c_Name });
                }
            }
            return View(model);
        }

        [HttpPost]
        public ActionResult SaveTask(TaskListViewModel model)
        {
            return Json(model);
        }

    }
}
